<template>
 <div >   
      <div class="modal-mask">
    <div class="modal-container">
      <div class="modal-header">
          <h2>物流相关信息</h2>
        <span class="close-btn" @click="$emit('closeDialog')">X</span>
      </div>
    <div class="logistics-info-header">
        <div class="logistics-info-header-left">
          <div class="logistics-status blue" v-changeColor="color">
            {{ deliverystatus }}
          </div>
          <div class="logistics-company">{{ orderInfo.logisticsCompany }}</div>
          <div class="logistics-no">{{ orderInfo.logisticsNo }}</div>
        </div>
      </div>
      <ul
        class="logistics-info-list"
        v-for="item in orderInfo.logisticsInfo"
        :key="item.time">
        <slot name="deliverInfo" :deliveryInfo="item"></slot>
      </ul>
    </div>
  </div>

 </div>
</template>

<script>
 export default {
   name: 'MyDeliveryInfo',
   props: {
    orderInfo:Object,
    
   },
   components: {

   },
   data () {
     return {

     }
   },
 computed: {
    deliverystatus() {
      switch (this.orderInfo.logisticsStatus) {
        case 0:
          return '未发货';
        case 1:
          return '已发货';
        case 2:
          return '已签收';
        case 3:
          return '未签收';

        default:
          0;
          return '未发货';
      }
    },
    color() {
      switch (this.orderInfo.logisticsStatus) {
        case 0:
          return '#087';
        case 1:
          return 'red';
        case 2:
          return 'blue';
        case 3:
          return 'pink';

        default:
          0;
          return '087';
      }
    },
  },
  directives: {
    changeColor: {
      inserted(el, binding) {
        el.style.color = binding.value;
      },
    },
  },
 }
</script>

<style scoped>
.logistics-info {
  border: 1px solid #ccc;
  border-radius: 5px;
  box-shadow: 0px 0px 10px #eee;
  padding: 10px;
  font-size: 14px;
}

.logistics-info-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.logistics-info-header-left {
  display: flex;
  align-items: center;
}

.logistics-status {
  font-weight: bold;
  font-size: 16px;
  color: #007bff;
}

.logistics-company,
.logistics-no {
  margin-left: 10px;
  font-size: 14px;
  color: #333;
}

.logistics-info-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 230px;
  overflow-y: auto;
}

.logistics-info-list li {
  display: flex;
  margin-bottom: 10px;
}

.logistics-info-list-time {
  font-size: 12px;
  color: #999;
  width: 80px;
  text-align: right;
  margin-right: 10px;
}

.logistics-info-list-content {
  font-size: 14px;
  color: #333;
}
.hidden {
  display: none !important;
}
.modal-mask {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-container {
  background-color: #fff;
  border-radius: 5px;
  padding: 20px;
  max-width: 500px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.close-btn {
  cursor: pointer;
}
</style>
